
export default class ThemeManager {

    private static _theme: string = 'secondary';
    private static _themeDict: { [key: string]: cc.Color[] } = {};

    public static initThemeManager() {
        this._themeDict = {
            primary: [
                this.FromHex('F39291'), // 0
                this.FromHex('A5E3FA'), // 1
                this.FromHex('AC9971'), // 2
                this.FromHex('515151'), // 3
                this.FromHex('FBCBA5'), // 4
                this.FromHex('ADADAD'), // 5
                this.FromHex('59CB86'), // 6
            ],
            secondary: [
                this.FromHex('4DD5B0'), // 0
                this.FromHex('ED954A'), // 1
                this.FromHex('98DC55'), // 2
                this.FromHex('DC6555'), // 3
                this.FromHex('5CBEE4'), // 4
                this.FromHex('4DD5B0'), // 5
                this.FromHex('59CB86'), // 6
            ]
        };
    }

    public static getColor(idx: number) {
        return this._themeDict[this._theme][idx];
    }

    private static FromHex(hex: string) {
        if (hex[0] != '#') hex = '#' + hex;

        const out = cc.color();
        cc.Color.fromHEX(out, hex);
        return out;
    }
}
